package pro.shushi.pamirs.demo.api.model;

import pro.shushi.pamirs.meta.annotation.Field;
import pro.shushi.pamirs.meta.annotation.Model;
import pro.shushi.pamirs.meta.base.common.VersionModel;
import pro.shushi.pamirs.meta.enmu.DateFormatEnum;
import pro.shushi.pamirs.meta.enmu.DateTypeEnum;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;


@Model.model(OrderDetail.MODEL_MODEL)
@Model(displayName = "订单详情", labelFields = "name")
public class OrderDetail extends VersionModel {

    private static final long serialVersionUID = -5104390780952631397L;

    public static final String MODEL_MODEL = "demo.OrderDetail";

    @Field.Integer
    @Field(displayName = "订单id", invisible = true)
    private Long orderId;

    @Field.many2one
    @Field.Relation(relationFields = {"productId"}, referenceFields = {"id"})
    @Field(displayName = "产品")
    private Product product;

    @Field.Integer
    @Field(displayName = "产品id", invisible = true)
    private Long productId;

    @Field.String
    @Field(displayName = "产品名称")
    private String productName;

    @Field.String
    @Field(displayName = "产品规格")
    private String productTypeName;

    @Field.many2one
    @Field.Relation(relationFields = {"productPlanId"}, referenceFields = {"id"})
    @Field(displayName = "班次")
    private ProductPlan productPlan;

    @Field.Integer
    @Field(displayName = "班次ID", invisible = true)
    private Long productPlanId;

    @Field.Integer
    @Field(displayName = "购买数量")
    private Integer num;

    @Field.Money(D = 2, min = "0.0")
    @Field(displayName = "公布单价")
    private BigDecimal publicPrice;


    @Field.Money(D = 2, min = "0.0")
    @Field(displayName = "单价")
    private BigDecimal accountPrice;


    @Field.Boolean
    @Field(displayName = "消费标志", defaultValue = "false")
    private Boolean consumeStatus;


    @Field.Date(type = DateTypeEnum.DATE, format = DateFormatEnum.DATE)
    @Field(displayName = "消费日期")
    private Date consumeDate;


    @Field.Date
    @Field(displayName = "实际消费时间")
    private Date realConsumeTime;


    @Field.String
    @Field(displayName = "消费码")
    private String consumeQr;


    @Field.Money(D = 2, min = "0.0")
    @Field(displayName = "公布总金额")
    private BigDecimal publicAmount;


    @Field.Money(D = 2, min = "0.0")
    @Field(displayName = "结算总金额")
    private BigDecimal amount;


    @Field.many2one
    @Field.Relation(relationFields = {"productStockId"}, referenceFields = {"id"})
    @Field(displayName = "库存")
    private ProductStock productStock;

    @Field.Integer
    @Field(displayName = "库存ID", invisible = true)
    private Long productStockId;


    @Field.Integer
    @Field(displayName = "价格ID", invisible = true)
    private Long productPriceId;


    @Field.many2one
    @Field.Relation(relationFields = {"productPriceId"}, referenceFields = {"id"})
    @Field(displayName = "价格")
    private ProductPrice productPrice;

    @Field.Boolean
    @Field(displayName = "是否可退")
    private Boolean refundFlag;

    @Field.Text
    @Field(displayName = "描述")
    private String description;

    @Field.one2many
    @Field(displayName = "订单乘客信息")
    @Field.Relation(relationFields = "id",referenceFields = "orderDetailId")
    private List<OrderPassenger> orderPassengers;
}
